<?php
require 'template/header.php';
?>

<div id="container">
    <div id="left-panel">
        <div class="left-stuff">
            <h3>Sản phẩm bán chạy</h3>
            <div class="pro-list">
                <div class="pro-item">
                    <a href="#"><image src="products/images/p1.jpg"></a>
                    <a href="#">Bep Gas âm Faber FB-702BG</a>
                    <span class="price p-new">8.480.000 VNĐ</span>
                    <span class="price p-old">11.000.000 VNĐ</span>
                </div>
                <div class="pro-item">
                    <a href="#"><image src="products/images/p2.jpg"></a>
                    <a href="#">Bep Gas âm Faber FB-702BG</a>
                    <span class="price p-new">8.480.000 VNĐ</span>
                    <span class="price p-old">11.000.000 VNĐ</span>
                </div>
            </div>
        </div>

        <div class="left-stuff">
            <h3>DANH MỤC SẢN PHẨM</h3>
            <ul id="left-menu">
                <li><a href="#">Bếp gas dương</a>
                    <ul class="list-menu">
                        <li><a href="#">Menu #1</a></li>
                        <li><a href="#">Menu #2</a></li>
                        <li><a href="#">Menu #3</a></li>
                        <li><a href="#">Menu #4</a></li>
                        <li><a href="#">Menu #5</a></li>
                    </ul>
                </li>
                <li><a href="#">Bếp gas âm</a>
                    <ul class="list-menu">
                        <li><a href="#">Menu #1</a></li>
                        <li><a href="#">Menu #2</a></li>
                        <li><a href="#">Menu #3</a></li>
                        <li><a href="#">Menu #4</a></li>
                        <li><a href="#">Menu #5</a></li>
                    </ul>
                </li>
                <li><a href="#">Máy hút khử mùi</a></li>
                <li><a href="#">Bếp điện từ</a></li>
                <li><a href="#">Chậu rửa bát</a></li>
                <li><a href="#">Bếp gas âm</a></li>
                <li><a href="#">Máy hút khử mùi</a></li>
                <li><a href="#">Bếp điện từ</a></li>
                <li><a href="#">Chậu rửa bát</a></li>
                <li><a href="#">Bếp gas âm</a></li>
                <li><a href="#">Máy hút khử mùi</a></li>
                <li><a href="#">Bếp điện từ</a></li>
                <li><a href="#">Chậu rửa bát</a></li>
                <li><a href="#">Bếp gas âm</a></li>
                <li><a href="#">Máy hút khử mùi</a></li>
                <li><a href="#">Bếp điện từ</a></li>
                <li><a href="#">Chậu rửa bát</a>
                    <ul class="list-menu">
                        <li><a href="#">Menu #1</a></li>
                        <li><a href="#">Menu #2</a></li>
                        <li><a href="#">Menu #3</a></li>
                        <li><a href="#">Menu #4</a></li>
                        <li><a href="#">Menu #5</a></li>
                    </ul>
                </li>
            </ul>
        </div>	
    </div>

    <div id="content">
        <div class="products">
            <?php
            $sql = "select * from tbl_products a join tbl_images b on a.pro_id = b.pro_id";
            $rows = $db->fetchAll($sql);
            $page = new Paging($url, $rows, 9);
            $rows = $page->getRecords(); 
            
            ?>
            <div class="products-title">
                <h3><a href="#">Category Name</a></h3>
            </div>
            <?php
            foreach ($rows as $p) {
                ?>
                <div class="product">
                    <a href="product-detail.php?id=<?php echo $p['pro_id']; ?>&cid=<?php echo $p['cat_id']; ?>"><img src="<?php echo $p['url']; ?>" /></a>
                            <a href="product-detail.php?id=<?php echo $p['pro_id']; ?>&cid=<?php echo $p['cat_id']; ?>"><h4><?php echo $p['name']; ?></h4></a>
                            <i>Tiết kiệm: 1.480.000 VNĐ</i>
                            <p><?php echo number_format($p['price'], 0, ',', '.'); ?> VNĐ</p>
                    
                </div>
                <?php
            }
            ?>
        </div>
        
        <?php
            echo $page->getPaging();
        ?>
<!--        <div class="pagination">
            <span><a href="">Prev</a></span>
            <span><a href="">1</a></span>
            <span><a href="">2</a></span>
            <span><a href="">3</a></span>
            <span><a href="">Next</a></span>
        </div>-->
    </div>
</div>

<?php
require 'template/footer.php';
?>